package com.chao.yyks.modular.problem.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.StrUtile;
import com.chao.common.util.exception.SysException;
import com.chao.yyks.modular.problem.bean.EnWordBank;
import com.chao.yyks.modular.problem.mapper.EnWordBankMapper;
import com.chao.yyks.modular.problem.service.EnWordBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.chao.common.util.reaction.PageList;
import java.util.List;


/**
 * 词汇信息ServiceImpl
 * chao
 * 2024-09-12
 */
@Service
public class EnWordBankServiceImpl implements EnWordBankService {

	/**
	 * 词汇信息Mapper
	 */
	@Autowired
	private EnWordBankMapper enWordBankMapper;

	/**
	 * 批量新增词汇信息
	 */
	@Override
	@Transactional
	public void insertAllEnWordBank(List<EnWordBank> enWordBankList){
		enWordBankList.forEach(enWordBank -> enWordBank.setWordBank(StrUtile.getId()));
		enWordBankMapper.insertAllEnWordBank(enWordBankList);
	}

	/**
	 * 物理删除词汇信息
	 */
	@Override
	@Transactional
	public void deleteDataEnWordBank(String wordBank){
		enWordBankMapper.deleteDataEnWordBank(wordBank);
	}

	/**
	 * 查询词汇信息列表
	 */
	@Override
	public PageList<EnWordBank> selectEnWordBankByList(JSONObject json){
		return enWordBankMapper.selectEnWordBankByList(json);
	}

}